#include "strngbad.h"
#include <iostream>
#include "strngbadTest.h"

static void callMe1(StringBad& rsb)
{
    using std::cout;

    cout << "String passed by reference:\n";
    cout << " \"" << rsb << "\"\n";
}

static void callMe2(StringBad sb)
{
    using std::cout;
    cout << "String passed by valud: \n";
    cout << "   \"" << sb << "\"\n";
}

static void useStringBad(void)
{
    using std::cout;
    using std::endl;

    cout << "Starting an inner block.\n";
    StringBad headline1("Celery Stalks at Midnight");
    StringBad headline2("Lettuce Prey");
    StringBad sports("Spinach Leaves Bowl for Dollars");

    cout << "headline1: " << headline1 << endl;
    cout << "headline2: " << headline2 << endl;
    cout << "sports: " << sports << endl;

    callMe1(headline1);
    cout << "headline1: " << headline1 << endl;
    
    callMe2(headline2);
    cout << "headline2: " << headline2 << endl;

    cout << "Initialize one object to another:\n";
    StringBad sailor = sports;
    cout << "sailor: " << sailor << endl;
    
    cout << "Assign one object to another: \n";
    StringBad knot;
    knot = headline1;
    cout << "knot: " << knot << endl;
    cout << "Exiting the block.\n";

}

void strngbadTest(void)
{
    useStringBad();
}
